Source Code Viewer - Example 2 - PageByIndexRangeFinder

package name.matthewgreet.example2.common;

import java.io.Serializable;
import java.util.List;


/**
 * <P>Strategy for lazy loading a page of records to display from an index range (0 based), typically with list size 
 * found by {@link ListSizeFinder}.  This is particularly useful for reading MySQL tables traversing an index using 
 * OFFSET and LIMIT keywords.</P>
 */
@FunctionalInterface
public interface PageByIndexRangeFinder<T extends Serializable> extends Serializable {
    
    /**
     * Returns items within a range of indices, where indices start at 0.  If the range covers indices that don't exist, 
     * any records that are in range should be returned.  No item should ever be null.  For convenience of MySQL 
     * adapters, OFFSET is startIndex and LIMIT is endIndex - startIndex + 1. 
     * 
     * @param startIndex Start of index range, where indices start at zero.
     * @param endIndex End of index range (inclusive), where indices start at zero.
     */
    public List<T> getItems(int startIndex, int endIndex) throws Exception;
}